<template>
	<view>
		<view class="content">
			<image mode="aspectFit" :src="host+data.cover"></image>
			<view class="text">
				<view>影片名称:{{data.name}}</view>
				<view>影片类型:{{category}}</view>
				<view>评分:{{data.score}}星</view>
				<view>语言:{{data.language}}</view>
				<view>播放类型:{{type}}</view>
				<view>时长:{{data.duration}}分钟</view>
				<view>上映时间:{{data.playDate}}</view>
				<view>想看人数:{{data.likeNum}}</view>
			</view>
			<view class="introduction">
				简介:<view v-html="data.introduction"></view>
			</view>
			<button @click="go_movie" size="mini" type="primary">主页</button>
		</view>
	</view>
</template>

<script>
	import {http} from "../../utils/request.js";
	export default {
		data() {
			return {
				host:uni.getStorageSync("BASE_URL"),
				id:"",
				data:{},
				category:"",
				type:""
			}
		},
		onLoad(data){
			this.id=data.id;
		},
		created() {
			let that=this;
			http({
				url:"/prod-api/api/movie/film/detail/"+that.id
			}).then((res)=>{
				that.data=res.data.data;
				uni.setNavigationBarTitle({
					title:that.data.name
				})
				let category_obj={
					"1":"故事",
					"2":"爱情",
					"3":"动作",
					"4":"喜剧",
					"5":"恐怖",
					"6":"惊悚",
					"7":"战争",
					"8":"科幻"
				};
				let type_obj={
					"1":"2D",
					"2":"3D",
					"3":"IMAX",
					"4":"4DX",
				};
				that.category=category_obj[that.data.category];
				that.type=type_obj[that.data.playType];
				
			})
		},
		methods: {
			go_movie(){
				uni.navigateBack({
					url:"/pages/movie/index"
				})
			}
		}
	}
</script>

<style>
	.content{
		width: 90%;
		margin: 0 auto;
		display: flex;
		flex-direction: column;
		background-color: #ecf0f1;
		align-items: center;
		justify-content: center;
	}
	.content>*{
		margin: 30rpx auto;
	}
	.text{
		display: flex;
		flex-direction: column;
	}
	.introduction{
		width: 80%;
		padding: 40rpx;
		background-color: #bdc3c7;
		border-radius: 40rpx;
		box-sizing: border-box;
	}
	.introduction>view{
		width: 100%;
		text-indent: 2rem;
	}
</style>
